fix(realunit): offer NewRegistration empty form for first-time users instead of KycRequired#3836
Merged
TaprootFreak merged 2 commits intoJun 8, 2026
Conversation
…instead of KycRequired getRegistrationInfo dead-ended onboarding for any wallet without pre-fillable KYC data: it returned KycRequired, which the client surfaces as a terminal "complete your identity verification first" failure — yet that is exactly the first-time user the registration flow exists to onboard. completeRegistration requires only KYC Level 10 (email) and persists manually-entered data when no prior data exists, so the form must be offered, not withheld. Return NewRegistration with userData omitted (empty form) when neither a registration step nor pre-fill data exist; the existing prefill path is unchanged. KycRequired is kept as a reserved, no-longer-emitted contract value so clients retain explicit handling. Regression introduced in DFXswiss#3782.
davidleomay
approved these changes
Jun 8, 2026
3 tasks
TaprootFreak
added a commit
to RealUnitCH/app
that referenced
this pull request
Jun 8, 2026
## Summary Backend [DFXswiss/api#3836](DFXswiss/api#3836) drops `KycRequired` from `RealUnitRegistrationState` (YAGNI — it is no longer emitted by `GET /v1/realunit/registration`). This removes the now-unreachable consumer-side handling so the app stops carrying dead code for a state the API never sends. ## Changes - `real_unit_registration_state.dart` — remove the `kycRequired(jsonName: 'KycRequired')` enum value. - `kyc_cubit.dart` — remove the `case RealUnitRegistrationState.kycRequired` dispatch arm. - `kyc_state.dart` — remove the `KycRequiredFailure` state class. - `kyc_page_manager.dart` — remove the `KycRequiredFailure()` → `KycFailurePage` switch arm. - `real_unit_registration_info_dto.dart` — drop the stale `kycRequired` mention from the doc comment. - `strings_de.arb` / `strings_en.arb` — remove the unused `kycRequiredFailureMessage` key. - `docs/wallet-modes.md` — drop the registration `KycRequired` references. - Tests — remove the obsolete `KycRequired` parse test and the `KycRequiredFailure` cubit test. ## Note `PaymentInfoError.kycRequired` (buy/sell) and the transaction-status `kycRequired` are unrelated concepts and remain untouched. After this change, an unexpected `state: 'KycRequired'` payload would throw `ArgumentError` (covered by the existing unknown-state test) — acceptable since the API no longer emits it. ## Test plan - [x] `flutter analyze` — clean (only a pre-existing, unrelated generated-i18n warning present on `staging`) - [x] `flutter test` — 2272 non-golden tests pass - [ ] Visual Regression / goldens via CI (no golden references the removed state)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
First-time RealUnit onboarding dead-ends. The app's
Onboarding processscreen shows:This is the client's
KycRequiredFailure, triggered whenGET /v1/realunit/registrationreturnsstate: KycRequired.Root cause
RealunitService.getRegistrationInfo()returnsKycRequiredwhenever there is no existing registration step andtoUserDataDtoFromUserData()returnsundefined— i.e.!firstname && !surname. That is exactly the first-time user (email registered → KYC Level 10, but no name on file yet).The client treats
KycRequiredas a terminal "complete your identity verification first" failure, so onboarding can never start — even though this is precisely the user the registration flow exists to onboard:completeRegistration()requires only KYC Level 10 + email and, for users with no prior data (!hasExistingData), persists the manually-entered form data (updatePersonalData(userData, dto.kycData)).NewRegistrationwith nouserDataby rendering an empty form (covered by its cubit + tests).The
KycRequiredbranch was introduced in #3782 (whose goal was only to pre-fill the form from existing KYC data) and unintentionally turned the previous empty-form path into a dead-end.Fix
When no registration step exists, always return
NewRegistration— pre-filled withuserDatawhen verified personal data is present, otherwise withoutuserDataso the client renders an empty form and collects every field manually. The existing prefill path is unchanged.KycRequiredis removed fromRealUnitRegistrationState: nothing emits it anymore, and per the repo's API Capability Design guideline (YAGNI for enum members — don't ship future-proof enum values without a current backend gate that emits them), keeping it would be dead code. Re-adding it the day a genuine "KYC blocked" gate actually throws is additive and backwards-compatible.Changes
realunit.service.ts— collapse thegetRegistrationInfofallthrough to a singleNewRegistrationreturn (userData= prefill orundefined); update comments.realunit-registration.dto.ts— documentNewRegistrationas covering prefilled and empty; remove the unemittedKycRequiredenum member and its mention in thestatedescription.realunit.controller.ts— dropKycRequiredfrom the routed-states list in the endpoint description.realunit.service.spec.ts— the no-data case now assertsNewRegistrationwith nouserData(first-time user → empty form).Test
Frontend synchronization
The realunit-app still has
KycRequiredFailurehandling for this state. The API now never emits it and drops it from the contract, so that client branch is dead and should be removed in the paired app PR.Note
Touches the same files as #3786 (registration →
aktionariat_registrationentity refactor), which does not address thisKycRequireddead-end. Whichever merges first, the other will need a small rebase.